<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        #app{
            width: 100px;height:100px;
        }
        #app2{
            width: 100px;height:100px;
        }
    </style>
</head>
<body>
    <div id="app">
        <my-child></my-child>
    </div>
    <div id="app2">
        <my-parent></my-parent>
    </div>
    <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
    <script>
        var child = {
            template:`
                <div style="float: left;border:1px solid red;">
                    <h1>孩子</h1>    
                </div>
            `
        }
        var parent = {
            template:`
                <div style="float: left;border:1px solid green;">
                    <h1>父亲</h1>
                    <my-child></my-child>
                </div>
            `,
            components:{
                "my-child":child
            }
        }
        new Vue({
            el:'#app',
            components:{
                "my-child":child
            }
        })
        new Vue({
            el:'#app2',
            components:{
                "my-parent":parent
            }
        })
    </script>
</body>
</html>